function autocompleteUtilisateurEquipe(item) {
	label = item.prenom + " " + item.nom;
	id = item.id;
	return {
		label : label,
		value : dn
	};
}

function autocompleteUtilisateurEquipeSelect(event, ui) {
	var idCourrant = this.id;
	var idDest = '"#' + idCourrant.substring(3) + '"';
	var idSelect = idCourrant.substring(3);
	var idDivDest = '#div' + idCourrant.substring(3) + '';
	var divDest = 'div' + idCourrant.substring(3);
	var monSelect = $(eval(idDest.toString()));
	var my = monSelect[0];
	var options = $(my).html();
	if (options == '\n    <option value=\"                                                                                                                                                                                                                                                                                                            \" label=\"                                                                                                                                                                                                                                                                                                            \">                                                                                                                                                                                                                                                                                                            </option>\n') {
		options = "";
	}
	if ($('#' + idSelect).attr('multiple')) {
		options += '<option value="' + ui.item.value + '" label="'
				+ ui.item.label + '" selected="selected">' + ui.item.label
				+ '</option>';
	} else {
		options = '<option value="' + ui.item.value + '" label="'
				+ ui.item.label + '" selected="selected">' + ui.item.label
				+ '</option>';
	}
	$(my).html(options).change();
	$("#" + idCourrant).val('');
	$(idDivDest).show("slow");
	var idSpan = new String(ui.item.value);

	var reg = new RegExp(" ", "g");
	idSpan = idSpan.replace(reg, "");
	var reg = new RegExp("/", "g");
	idSpan = idSpan.replace(reg, "");
	var reg = new RegExp(",", "g");
	idSpan = idSpan.replace(reg, "");
	var reg = new RegExp("=", "g");
	idSpan = idSpan.replace(reg, "");

	var valActuelle = $(idDivDest).html();
	if (valActuelle.substring(0, 11) == '<div id="">') {
		valActuelle = "";
	}
	var img = '<img src="/images/supprimerListe.png" alt="Supprimer" border="0" onclick="supprimerUtilisateurEquipeSelect(\''
			+ idSpan
			+ '\', \''
			+ ui.item.value
			+ '\', \''
			+ ui.item.label
			+ '\', \'' + divDest + '\', \'' + idSelect + '\')" />';
	var val = '<div id="' + idSpan + '">' + ui.item.label + img + "</div>";
	if ($('#' + idSelect).attr('multiple')) {
		$(idDivDest).html(valActuelle + val);
	} else {
		$(idDivDest).html(val);
	}
}

function supprimerUtilisateurEquipeSelect ( id, value, label, div, select ) {
	$("#" + id).remove();
	var restant = $(div).html();
	if ( restant == "" || restant == "<br>"  ) {
		$(div).hide();
	}
	var options = $("#" + select).html();
	var reg = '<option value="' + value + '" label="' + label + '" selected="selected">' + label + '</option>';
	options = options.replace(reg, "");
	$("#" +select).html(options).change();
}